﻿// <copyright file="AdminEditUserViewModel.cs" company="Clever Software">
// Copyright (c) 2013, 2014 All Right Reserved, http://www.cleversoftware.by
//
// This source is subject to the Microsoft Permissive License.
// Please see the License.txt file for more information.
// All other rights reserved.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// </copyright>
// <author>Clever Software</author>
// <email>info@cleversoftware.by</email>
// <date>2014-02-04</date> 
// <summary>CleverCMS source code</summary>

namespace CleverCMS.Cms.Services.ViewModels
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using CleverCMS.Cms.Data.Entities;

    public class AdminEditUserViewModel
    {
        public int Id { get; set; }

        public DateTime CreatedAt { get; set; }

        [Required(ErrorMessage = "Empty Login")]
        public string Login { get; set; }

        [Required(ErrorMessage = "Empty Name")]
        public string DisplayName { get; set; }

        [Required(ErrorMessage = "*")]
        [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", ErrorMessage = "Email addresses incorrectly formatted")]
        [DataType(DataType.EmailAddress)]
        public string Email { get; set; }

        [MinLength(6)]
        public string Password { get; set; }

        [MinLength(6)]
        public string CurrentPassword { get; set; } 

        [DisplayName("Role")]
        [Required(ErrorMessage = "Select role")]
        public long? RoleId { get; set; }

        public List<Role> Roles { get; set; }
    }
}